﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Data.Entity.Spatial;
using System.Linq;
using System.Web;

namespace TheCup
{
    [Table("mastercourse")]
    public class Course
    {
        [Key]
        [Column("no")]
        public int Id { get; set; }

        public string Name { get; set; }
        public string Address { get; set; }
        public string ZipCode { get; set; }
        public string City { get; set; }
        
        [NotMapped]
        public string GeoAddress
        {
            get
            {
                return Address + "," + ZipCode + " " + City;
            }
        }

        // Geo info
        public Nullable<double> Lng { get; set; }
        public Nullable<double> Lat { get; set; }

        [NotMapped]
        public string NameForDropdown
        {
            get
            {
                return string.Format("{0} ({1})", this.Name, this.CountryCodeISO3166Alpha2);
            }
        }

        [Column("ISO3166Alpha2")]
        public string CountryCodeISO3166Alpha2 { get; set; }

        public virtual List<Tee> Tees { get; set; }

        [Column("Id")]
        [Obsolete]
        public Guid uuid { get; set; }
    }

}